package org.funtester.performance.books.chapter02.section2;

public class SynchronizedDemoSecond {


    public static void main(String[] args) {
        SynchronizedDemoSecond first = new SynchronizedDemoSecond();
        for (int i = 0; i < 3; i++) {
            new Thread(() -> {
                first.test();
            }).start();

        }

    }

    public void test() {
        synchronized (this) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println(System.currentTimeMillis() + "  Hello FunTester!  " + Thread.currentThread().getName());
        }
    }


}
